package com.example.EurekaProvider;

import java.util.HashMap;
import java.util.Map;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
	
	@GetMapping("/hello")
	public String hello() {
		
		return "hello-provider";
	}
	
	@PostMapping("/postObj")
	public Object postObj(@RequestBody Map m) {
		HashMap<String, String> map = new HashMap<String, String>() {
		    {
		        put("name", m.get("name").toString());  
		        put("age", m.get("id").toString()); 
		    }
		};
		return map;
	}

}
